feat: Add SNMP Monitor#4717
Conversation
This commit introduces a new SNMP monitor feature to the application, allowing users to monitor devices using SNMP (Simple Network Management Protocol).
net-snmp over snmp-native is: -more robust -more popular -better documented -supports v3
Further testing of SNMP feat, however I'm running into the issue `Error in SNMP check: RequestTimedOutError: Request timed out` when the check function is called. I am unsure as to why since my local SNMP script works great with very similar code.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks for pointing it out @CommanderStorm!
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
DB must allow nulls otherwise this will break other monitors.
knex requires down function
Updates appropriate values async when editing the SNMP monitor
|
@CommanderStorm I'm ready for review. It is not passing ES Lint, although when I run |
Co-authored-by: Frank Elsinga <frank@elsinga.de>
Co-Authored-By: Frank Elsinga <frank.elsinga@tum.de>
Co-Authored-By: Frank Elsinga <frank.elsinga@tum.de>
Revert change from "Hostname" to "Hostname or IP Address" from efb1642
|
Just to be absolutely sure this feat is ready to ship from my perspective, I tested many scenarios for both the SNMP and JSON Query monitor types. I tested various edge cases and went through each condition ( In the spoiler below is a table with most of the scenarios, and how the console displays the UP/DOWN status: Details
|
|
Hey @chakflying wondering if you'd be willing to take a look at this again? |
|
Any news on this? Really looking forward to it. 😄 |
No news yet but if you're able to help test I would appreciate it. You can spin up your own Docker instance of this PR with |
|
When I try to deploy it, it gives an error. Where it says is has no access to /data/upload. Do you know what that means? If I don't setup a persistent directory on /app/data, the database-setup page stays blank. Could just be me being dumb, but I don't understand what's going on. 😅 |
It would be simple enough to return the raw SNMP value from Can you reference a PR so I can better understand what you mean by "table data"? |
|
Thanks for the new monitor! 🎉 Note This PR is part of the All changes in this PR are small and uncontroversial ⇒ merging with junior maintainer approval |
|
@mattv8, how can I test this? Will it only be released with v2? |
|
Try this: git clone https://github.com/louislam/uptime-kuma.git # Assuming you have git installedcd uptime-kuma # Change into the directory you just clonedgit fetch origin pull/4717/head:pr-4717 && git checkout pr-4717 # Check out this PRnpm ci # Assuming you have node and npm installednpm run dev # This will start the server on http://localhost:3000 |
|
@mattv8 Hey how can I try this release with SNMP support if i'm already running v 1.23.13? |
|
V2.0 is currently not released. Please see #4500 for further details on the bugs that need fixing. |
| throw new Error("Empty or undefined response. Check query syntax and response structure"); | ||
| } | ||
| if (typeof response === "object" || response instanceof Date || typeof response === "function") { | ||
| throw new Error(`The post-JSON query evaluated response from the server is of type ${typeof response}, which cannot be directly compared to the expected value`); |

Tick the checkbox if you understand [x]:
Description (Updated 06 June 2024 to reflect new scope)
This PR introduces a new SNMP monitor type and extends the functionality of JSON query monitoring with additional comparison operators. The following changes have been made:
Uptime Kuma Core
evaluateJsonQuery(data: any, jsonPath: string, jsonPathOperator: string, expectedValue: any), which returns{ status: boolean, response: any }wherestatusis the UP/DOWN evaluation andresponseis the result of the JSON query evaluation.New SNMP Monitor Type:
evaluateJsonQuery()to determine monitor status based on SNMP values and configured conditions.JSON Query Monitoring:
evaluateJsonQuery()to determine monitor status based on JSON query evaluation and configured conditions.==,!=,<,<=,>,>=).==if the operator is not specified in existing configurations.Resolves #1675
Resolves #4715
Resolves #4614
Resolves #4617
Type of change
Please delete any options that are not relevant.
Checklist
Screenshots